package com.intelligentclass.services;

import com.intelligentclass.entity.Student;
import com.intelligentclass.repositories.StudentRespository;
import jakarta.persistence.EntityNotFoundException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class StudentService {

    private StudentRespository studentRespository;

    public StudentService(StudentRespository studentRespository) {
        this.studentRespository = studentRespository;
    }

    public Student searchBySno(String sno) {
        return studentRespository.findById(sno).orElse(null);
    }

    public Student save(Student student) {
        return studentRespository.save(student);
    }
}
